/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import com.comac.ins.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 自然网格模型对比-任务状态枚举
 *
 * @author lj
 * @date 2025-01-13
 */
@AllArgsConstructor
@Getter
public enum IsfdMeshCompareTaskStatusEnum {
    IN_PROGRESS("in_progress", "对比中"),
    COMPLETED("completed", "对比完成"),
    FAILED("failed", "对比失败");
    private final String value;
    private final String desc;

    public static String getDescByValue(String value) {
        IsfdMeshCompareTaskStatusEnum isfdAnalysisApplicationTypeEnum = forValue(value);
        if (isfdAnalysisApplicationTypeEnum == null) {
            return null;
        }
        return isfdAnalysisApplicationTypeEnum.getDesc();
    }

    public static IsfdMeshCompareTaskStatusEnum forValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (IsfdMeshCompareTaskStatusEnum isfdAnalysisApplicationTypeEnum : IsfdMeshCompareTaskStatusEnum.values()) {
            if (isfdAnalysisApplicationTypeEnum.getValue().equals(value)) {
                return isfdAnalysisApplicationTypeEnum;
            }
        }
        return null;
    }

    public static IsfdMeshCompareTaskStatusEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdMeshCompareTaskStatusEnum isfdAnalysisApplicationTypeEnum : IsfdMeshCompareTaskStatusEnum.values()) {
            if (desc.equals(isfdAnalysisApplicationTypeEnum.getDesc())) {
                return isfdAnalysisApplicationTypeEnum;
            }
        }
        return null;
    }
}
